﻿// RomConstants.cs:
// Contains constants of ROM values (maker codes, company codes etc.).
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License.
// See LICENSE for more information.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;

namespace SharpNitroLib.NDS
{
    public static class RomConstants
    {
		/// <summary>
		/// CRC 16 Lookup.
		/// </summary>
        private static readonly UInt16[] _crc16tab = new UInt16[]
                                       {
                                           0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
                                           0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
                                           0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
                                           0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
                                           0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
                                           0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
                                           0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
                                           0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
                                           0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
                                           0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
                                           0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
                                           0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
                                           0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
                                           0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
                                           0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
                                           0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
                                           0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
                                           0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
                                           0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
                                           0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
                                           0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
                                           0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
                                           0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
                                           0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
                                           0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
                                           0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
                                           0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
                                           0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
                                           0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
                                           0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
                                           0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
                                           0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
                                       };

        /// <summary>
        /// List of ROM countries.
        /// </summary>
        private static RomCountry[] _romCountries = new[]
                                         {
                                             new RomCountry('J', "JPN", "Japan"),
                                             new RomCountry('E', "USA", "United States"),
                                             new RomCountry('P', "EUR", "Europe"),
                                             new RomCountry('D', "NOE", "Germany"),
                                             new RomCountry('F', "NOE", "France"),
                                             new RomCountry('I', "ITA", "Italy"),
                                             new RomCountry('S', "SPA", "Spain"),
                                             new RomCountry('H', "HOL", "Holand"),
                                             new RomCountry('K', "KOR", "Korea"),
                                             new RomCountry('X', "EUU", "???") //TODO: does anyone know what this is?
                                         };
        // TODO: adjust.
        /*
Maker[] makers = new Maker[]
{
	new Maker("01", "Nintendo"),
	new Maker("02", "Rocket Games, Ajinomoto"),
	new Maker("03", "Imagineer-Zoom"),
	new Maker("04", "Gray Matter?"),
	new Maker("05", "Zamuse"),
	new Maker("06", "Falcom"),
	new Maker("07", "Enix?"),
	new Maker("08", "Capcom"),
	new Maker("09", "Hot B Co."),
	new Maker("0A", "Jaleco"),
	new Maker("0B", "Coconuts Japan"),
	new Maker("0C", "Coconuts Japan/G.X.Media"),
	new Maker("0D", "Micronet?"),
	new Maker("0E", "Technos"),
	new Maker("0F", "Mebio Software"),
	new Maker("0G", "Shouei System"),
	new Maker("0H", "Starfish"),
	new Maker("0J", "Mitsui Fudosan/Dentsu"),
	new Maker("0L", "Warashi Inc."),
	new Maker("0N", "Nowpro"),
	new Maker("0P", "Game Village"),
	new Maker("10", "?????????????"),
	new Maker("12", "Infocom"),
	new Maker("13", "Electronic Arts Japan"),
	new Maker("15", "Cobra Team"),
	new Maker("16", "Human/Field"),
	new Maker("17", "KOEI"),
	new Maker("18", "Hudson Soft"),
	new Maker("19", "S.C.P."),
	new Maker("1A", "Yanoman"),
	new Maker("1C", "Tecmo Products"),
	new Maker("1D", "Japan Glary Business"),
	new Maker("1E", "Forum/OpenSystem"),
	new Maker("1F", "Virgin Games"),
	new Maker("1G", "SMDE"),
	new Maker("1J", "Daikokudenki"),
	new Maker("1P", "Creatures Inc."),
	new Maker("1Q", "TDK Deep Impresion"),
	new Maker("20", "Destination Software, KSS"),
	new Maker("21", "Sunsoft/Tokai Engineering??"),
	new Maker("22", "POW, VR 1 Japan??"),
	new Maker("23", "Micro World"),
	new Maker("25", "San-X"),
	new Maker("26", "Enix"),
	new Maker("27", "Loriciel/Electro Brain"),
	new Maker("28", "Kemco Japan"),
	new Maker("29", "Seta"),
	new Maker("2A", "Culture Brain"),
	new Maker("2C", "Palsoft"),
	new Maker("2D", "Visit Co.,Ltd."),
	new Maker("2E", "Intec"),
	new Maker("2F", "System Sacom"),
	new Maker("2G", "Poppo"),
	new Maker("2H", "Ubisoft Japan"),
	new Maker("2J", "Media Works"),
	new Maker("2K", "NEC InterChannel"),
	new Maker("2L", "Tam"),
	new Maker("2M", "Jordan"),
	new Maker("2N", "Smilesoft ???, Rocket ???"),
	new Maker("2Q", "Mediakite",
	new Maker("30", "Viacom",
	new Maker("31", "Carrozzeria",
	new Maker("32", "Dynamic",
	//"33", "NOT A COMPANY!",
	new Maker("34", "Magifact",
	new Maker("35", "Hect",
	new Maker("36", "Codemasters",
	new Maker("37", "Taito/GAGA Communications",
	new Maker("38", "Laguna",
	new Maker("39", "Telstar Fun & Games, Event/Taito",
	new Maker("3B", "Arcade Zone Ltd",
	new Maker("3C", "Entertainment International/Empire Software?",
	new Maker("3D", "Loriciel",
	new Maker("3E", "Gremlin Graphics",
	new Maker("3F", "K.Amusement Leasing Co.",
	new Maker("40", "Seika Corp.",
	new Maker("41", "Ubi Soft Entertainment",
	new Maker("42", "Sunsoft US?",
	new Maker("44", "Life Fitness",
	new Maker("46", "System 3",
	new Maker("47", "Spectrum Holobyte",
	new Maker("49", "IREM",
	new Maker("4B", "Raya Systems",
	new Maker("4C", "Renovation Products",
	new Maker("4D", "Malibu Games",
	new Maker("4F", "Eidos (was U.S. Gold <=1995)",
	new Maker("4G", "Playmates Interactive?",
	new Maker("4J", "Fox Interactive",
	new Maker("4K", "Time Warner Interactive",
	new Maker("4Q", "Disney Interactive",
	new Maker("4S", "Black Pearl",
	new Maker("4U", "Advanced Productions",
	new Maker("4X", "GT Interactive",
	new Maker("4Y", "RARE?",
	new Maker("4Z", "Crave Entertainment",
	new Maker("50", "Absolute Entertainment",
	new Maker("51", "Acclaim",
	new Maker("52", "Activision",
	new Maker("53", "American Sammy",
	new Maker("54", "Take 2 Interactive (before it was GameTek)",
	new Maker("55", "Hi Tech",
	new Maker("56", "LJN LTD.",
	new Maker("58", "Mattel",
	new Maker("5A", "Mindscape, Red Orb Entertainment?",
	new Maker("5B", "Romstar",
	new Maker("5C", "Taxan",
	new Maker("5D", "Midway (before it was Tradewest)",
	new Maker("5F", "American Softworks",
	new Maker("5G", "Majesco Sales Inc",
	new Maker("5H", "3DO",
	new Maker("5K", "Hasbro",
	new Maker("5L", "NewKidCo",
	new Maker("5M", "Telegames",
	new Maker("5N", "Metro3D",
	new Maker("5P", "Vatical Entertainment",
	new Maker("5Q", "LEGO Media",
	new Maker("5S", "Xicat Interactive",
	new Maker("5T", "Cryo Interactive",
	new Maker("5W", "Red Storm Entertainment",
	new Maker("5X", "Microids",
	new Maker("5Z", "Conspiracy/Swing",
	new Maker("60", "Titus",
	new Maker("61", "Virgin Interactive",
	new Maker("62", "Maxis",
	new Maker("64", "LucasArts Entertainment",
	new Maker("67", "Ocean",
	new Maker("69", "Electronic Arts",
	new Maker("6B", "Laser Beam",
	new Maker("6E", "Elite Systems",
	new Maker("6F", "Electro Brain",
	new Maker("6G", "The Learning Company",
	new Maker("6H", "BBC",
	new Maker("6J", "Software 2000",
	new Maker("6L", "BAM! Entertainment",
	new Maker("6M", "Studio 3",
	new Maker("6Q", "Classified Games",
	new Maker("6S", "TDK Mediactive",
	new Maker("6U", "DreamCatcher",
	new Maker("6V", "JoWood Produtions",
	new Maker("6W", "SEGA",
	new Maker("6X", "Wannado Edition",
	new Maker("6Y", "LSP",
	new Maker("6Z", "ITE Media",
	new Maker("70", "Infogrames",
	new Maker("71", "Interplay",
	new Maker("72", "JVC",
	new Maker("73", "Parker Brothers",
	new Maker("75", "Sales Curve",
	new Maker("78", "THQ",
	new Maker("79", "Accolade",
	new Maker("7A", "Triffix Entertainment",
	new Maker("7C", "Microprose Software",
	new Maker("7D", "Universal Interactive, Sierra, Simon & Schuster?",
	new Maker("7F", "Kemco",
	new Maker("7G", "Rage Software",
	new Maker("7H", "Encore",
	new Maker("7J", "Zoo",
	new Maker("7K", "BVM",
	new Maker("7L", "Simon & Schuster Interactive",
	new Maker("7M", "Asmik Ace Entertainment Inc./AIA",
	new Maker("7N", "Empire Interactive?",
	new Maker("7Q", "Jester Interactive",
	new Maker("7T", "Scholastic",
	new Maker("7U", "Ignition Entertainment",
	new Maker("7W", "Stadlbauer",
	new Maker("80", "Misawa",
	new Maker("81", "Teichiku",
	new Maker("82", "Namco Ltd.",
	new Maker("83", "LOZC",
	new Maker("84", "KOEI",
	new Maker("86", "Tokuma Shoten Intermedia",
	new Maker("87", "Tsukuda Original",
	new Maker("88", "DATAM-Polystar",
	new Maker("8B", "Bulletproof Software",
	new Maker("8C", "Vic Tokai Inc.",
	new Maker("8E", "Character Soft",
	new Maker("8F", "I'Max",
	new Maker("8G", "Saurus",
	new Maker("8J", "General Entertainment",
	new Maker("8N", "Success",
	new Maker("8P", "SEGA Japan",
	new Maker("90", "Takara Amusement",
	new Maker("91", "Chun Soft",
	new Maker("92", "Video System, McO'River???",
	new Maker("93", "BEC",
	new Maker("95", "Varie",
	new Maker("96", "Yonezawa/S'pal",
	new Maker("97", "Kaneko",
	new Maker("99", "Victor Interactive Software, Pack in Video",
	new Maker("9A", "Nichibutsu/Nihon Bussan",
	new Maker("9B", "Tecmo",
	new Maker("9C", "Imagineer",
	new Maker("9F", "Nova",
	new Maker("9G", "Den'Z",
	new Maker("9H", "Bottom Up",
	new Maker("9J", "TGL",
	new Maker("9L", "Hasbro Japan?",
	new Maker("9N", "Marvelous Entertainment",
	new Maker("9P", "Keynet Inc.",
	new Maker("9Q", "Hands-On Entertainment",
	new Maker("A0", "Telenet",
	new Maker("A1", "Hori",
	new Maker("A4", "Konami",
	new Maker("A5", "K.Amusement Leasing Co.",
	new Maker("A6", "Kawada",
	new Maker("A7", "Takara",
	new Maker("A9", "Technos Japan Corp.",
	new Maker("AA", "JVC, Victor Musical Indutries",     
	new Maker("AC", "Toei Animation",
	new Maker("AD", "Toho",
	new Maker("AF", "Namco",
	new Maker("AG", "Media Rings Corporation",
	new Maker("AH", "J-Wing",
	new Maker("AJ", "Pioneer LDC",
	new Maker("AK", "KID",
	new Maker("AL", "Mediafactory",
	new Maker("AP", "Infogrames Hudson",
	new Maker("AQ", "Kiratto. Ludic Inc",
	new Maker("B0", "Acclaim Japan",
	new Maker("B1", "ASCII (was Nexoft?)",
	new Maker("B2", "Bandai",
	new Maker("B4", "Enix",
	new Maker("B6", "HAL Laboratory",
	new Maker("B7", "SNK",
	new Maker("B9", "Pony Canyon",
	new Maker("BA", "Culture Brain",
	new Maker("BB", "Sunsoft",
	new Maker("BC", "Toshiba EMI",
	new Maker("BD", "Sony Imagesoft",
	new Maker("BF", "Sammy",
	new Maker("BG", "Magical",
	new Maker("BH", "Visco",
	new Maker("BJ", "Compile",
	new Maker("BL", "MTO Inc.",
	new Maker("BN", "Sunrise Interactive",
	new Maker("BP", "Global A Entertainment",
	new Maker("BQ", "Fuuki",
	new Maker("C0", "Taito",
	new Maker("C2", "Kemco",
	new Maker("C3", "Square",
	new Maker("C4", "Tokuma Shoten",
	new Maker("C5", "Data East",
	new Maker("C6", "Tonkin House	(was Tokyo Shoseki)",
	new Maker("C8", "Koei",
	new Maker("CA", "Konami/Ultra/Palcom",
	new Maker("CB", "NTVIC/VAP",
	new Maker("CC", "Use Co.,Ltd.",
	new Maker("CD", "Meldac",
	new Maker("CE", "Pony Canyon",
	new Maker("CF", "Angel, Sotsu Agency/Sunrise",
	new Maker("CJ", "Boss",
	new Maker("CG", "Yumedia/Aroma Co., Ltd",
	new Maker("CK", "Axela/Crea-Tech?",
	new Maker("CL", "Sekaibunka-Sha, Sumire kobo?, Marigul Management Inc.?",
	new Maker("CM", "Konami Computer Entertainment Osaka",
	new Maker("CP", "Enterbrain",
	new Maker("D0", "Taito/Disco",
	new Maker("D1", "Sofel",
	new Maker("D2", "Quest, Bothtec",
	new Maker("D3", "Sigma, ?????",
	new Maker("D4", "Ask Kodansha",
	new Maker("D6", "Naxat",
	new Maker("D7", "Copya System",
	new Maker("D8", "Capcom Co., Ltd.",
	new Maker("D9", "Banpresto",
	new Maker("DA", "TOMY",
	new Maker("DB", "LJN Japan",
	new Maker("DD", "NCS",
	new Maker("DE", "Human Entertainment",
	new Maker("DF", "Altron",
	new Maker("DG", "Jaleco???",
	new Maker("DH", "Gaps Inc.",
	new Maker("DL", "????",
	new Maker("DN", "Elf",
	new Maker("E0", "Jaleco",
	new Maker("E1", "????",
	new Maker("E2", "Yutaka",
	new Maker("E3", "Varie",
	new Maker("E4", "T&ESoft",
	new Maker("E5", "Epoch",
	new Maker("E7", "Athena",
	new Maker("E8", "Asmik",
	new Maker("E9", "Natsume",
	new Maker("EA", "King Records",
	new Maker("EB", "Atlus",
	new Maker("EC", "Epic/Sony Records",
	new Maker("EE", "IGS",
	new Maker("EG", "Chatnoir",
	new Maker("EH", "Right Stuff",
	new Maker("EJ", "????",
	new Maker("EL", "Spike",
	new Maker("EM", "Konami Computer Entertainment Tokyo",
	new Maker("EN", "Alphadream Corporation",
	new Maker("F0", "A Wave",
	new Maker("F1", "Motown Software",
	new Maker("F2", "Left Field Entertainment",
	new Maker("F3", "Extreme Ent. Grp.",
	new Maker("F4", "TecMagik",
	new Maker("F9", "Cybersoft",
	new Maker("FB", "Psygnosis",
	new Maker("FE", "Davidson/Western Tech.",
	new Maker("G1", "PCCW Japan,"
	new Maker("G4", "KiKi Co Ltd",
	new Maker("G5", "Open Sesame Inc???",
	new Maker("G6", "Sims",
	new Maker("G7", "Broccoli",
	new Maker("G8", "Avex",
	new Maker("G9", "D3 Publisher",
	new Maker("GB", "Konami Computer Entertainment Japan",
	new Maker("GD", "Square-Enix",
	new Maker("IH", "Yojigen",
};*/

        /// <summary>
        /// CRC16 Lookup
        /// </summary>
        public static ushort[] Crc16Tab
        {
            get { return _crc16tab; }

        }

        /// <summary>
        /// List of ROM countries.
        /// </summary>
        public static RomCountry[] RomCountries
        {
            get { return _romCountries; }
        }
    }


   
}